package com.aaa.jx.service.impl;

import com.aaa.jx.entity.SdsDetail;
import com.aaa.jx.entity.TSdsRecordDetail;
import com.aaa.jx.dao.TSdsRecordDetailDao;
import com.aaa.jx.entity.TjMessage;
import com.aaa.jx.entity.Ttongji;
import com.aaa.jx.service.TSdsRecordDetailService;
/**
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
*/
import com.util.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;
import javax.annotation.Resource;
import java.util.List;

/**
 * (TSdsRecordDetail)表服务实现类
 *
 * @author makejava
 * @since 2023-05-08 14:38:55
 */
//@Service("tSdsRecordDetailService")
public class TSdsRecordDetailServiceImpl implements TSdsRecordDetailService {
/**
    @Resource
    private TSdsRecordDetailDao tSdsRecordDetailDao;
*/
    SqlSession session= SqlSessionFactoryUtil.getSession();
    TSdsRecordDetailDao tSdsRecordDetailDao= session.getMapper(TSdsRecordDetailDao.class);

    @Override
    public List<TjMessage> getTjData2() {
        return this.tSdsRecordDetailDao.getTjData2();
    }

    @Override
    public List<Ttongji> getTjData() {
        return this.tSdsRecordDetailDao.getTjData();
    }

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public List<SdsDetail> queryById(Integer id) {
        return this.tSdsRecordDetailDao.queryById(id);
    }

    /**
     * 分页查询
     *
     * @param tSdsRecordDetail 筛选条件
     * @param pageRequest      分页对象
     * @return 查询结果
     */
     /**
    @Override
    public Page<TSdsRecordDetail> queryByPage(TSdsRecordDetail tSdsRecordDetail, PageRequest pageRequest) {
        long total = this.tSdsRecordDetailDao.count(tSdsRecordDetail);
        return new PageImpl<>(this.tSdsRecordDetailDao.queryAllByLimit(tSdsRecordDetail, pageRequest), pageRequest, total);
    }*/

    /**
     * 新增数据
     *
     * @param tSdsRecordDetail 实例对象
     * @return 实例对象
     */
    @Override
    public TSdsRecordDetail insert(TSdsRecordDetail tSdsRecordDetail) {
        this.tSdsRecordDetailDao.insert(tSdsRecordDetail);
        return tSdsRecordDetail;
    }

    /**
     * 修改数据
     *
     * @param tSdsRecordDetail 实例对象
     * @return 实例对象
     */
//    @Override
//    public TSdsRecordDetail update(TSdsRecordDetail tSdsRecordDetail) {
//        this.tSdsRecordDetailDao.update(tSdsRecordDetail);
//        return this.queryById(tSdsRecordDetail.getId());
//    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.tSdsRecordDetailDao.deleteById(id) > 0;
    }
}
